'use strict';

const vinylFs = require('vinyl-fs');
const jshint = require('gulp-jshint');
const stylish = require('jshint-stylish');
const util = require('util');

module.exports = function (src, resolve, reject) {
  vinylFs.src(src)
    .pipe(jshint('.jshintrc'))
    .on('error', function (err) {
      if (util.isFunction(reject)) {
        reject(err);
      }
    }).on('end', function () {
      if (util.isFunction(resolve)) {
        setTimeout(function () {
          resolve();
        }, 100);
      }
    })
    .pipe(jshint.reporter(stylish));
};